package com.platform.study.thread;

/**
 * 用实现Runnable接口方式实现线程:后台线程
 * User: wangyanginfo
 * Date: 12-11-26
 * Time: 下午2:44
 */
public class RunnableSimple_5 implements Runnable {

    @Override
    public void run() {
        while(true){
            System.out.println(Thread.currentThread().getName() + " 正在运行");
        }
    }

    public static void main(String[] args) {
        RunnableSimple_5 simpleA = new RunnableSimple_5();
        Thread thread = new Thread(simpleA, "线程1");
        System.out.println("线程启动之前---》" + thread.isAlive());
        thread.setDaemon(true); //设置为后台线程
        thread.start();
        System.out.println("线程启动之后---》" + thread.isAlive());
    }
}
